<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/module.js" type="text/javascript">
		</script>
	</head>

	<body>
		<a href="#" title="我是一个好人">我是一个好人</a>
		<input type="text" vm-value="name" />
	</body>
	<script>
		var person = {

		}
	</script>
	<script type="text/javascript">
		thin.define("constant.PI", [], function() {
			return 3.14159;
		});
		//圆
		thin.define("shape.Circle", ["constant.PI"], function(pi) {
			var Circle = function(r) {
				this.r = r;
			};
			Circle.prototype = {
				area: function() {
					return pi * this.r * this.r;
				}
			};
			return Circle;
		});
		//矩形长方形
		thin.define("shape.Rectangle", [], function() {
			var Rectangle = function(l, w) {
				this.l = l;
				this.w = w;
			};
			Rectangle.prototype = {
				area: function() {
					return this.l * this.w;
				}
			};
			return Rectangle;
		});
		//形状
		thin.define("ShapeTypes", ["shape.Circle", "shape.Rectangle"], function(Circle, Rectangle) {
			return {
				CIRCLE: Circle,
				RECTANGLE: Rectangle
			};
		});
		thin.define("ShapeFactory", ["ShapeTypes"], function(ShapeTypes) {
			return {
				//获取形状
				getShape: function(type) {
					var shape;
					switch(type) {
						case "CIRCLE":
							{
								shape = new ShapeTypes[type](arguments[1]);
								break;
							}
						case "RECTANGLE":
							{
								shape = new ShapeTypes[type](arguments[1], arguments[2]);
								break;
							}
					}
					return shape;
				}
			};
		});

		var ShapeFactory = thin.use("ShapeFactory");
		alert(ShapeFactory.getShape("CIRCLE", 5).area());
		alert(ShapeFactory.getShape("RECTANGLE", 3, 4).area());
	</script>

</html>